#define _CRT_SECURE_NO_WARNINGS 1


class Solution {
public:
    double myPow(double x, int n) {
        return n >= 0 ? pow(x, n) : 1.0 / pow(x, -(long long)n);
    }

    double pow(double x, long long n)
    {
        if (n == 0) return 1.0;
        double temp = pow(x, n / 2);
        return n % 2 == 0 ? temp * temp : temp * temp * x;
    }
};